package com.mentalhealthplatform.studentV3.ai.jimmer;

import jakarta.persistence.PrePersist;
import jakarta.persistence.PreUpdate;
import java.time.LocalDateTime;

public class BaseDateTimeDraftInterceptor {

    @PrePersist
    public void prePersist(BaseEntity entity) {
        LocalDateTime now = LocalDateTime.now();
        entity.setCreatedTime(now);
        entity.setEditedTime(now);
    }

    @PreUpdate
    public void preUpdate(BaseEntity entity) {
        entity.setEditedTime(LocalDateTime.now());
    }
}